package com.fulihui.wgj.auth.config;

import com.fulihui.weixinsdk.WeixinSDK;
import com.fulihui.weixinsdk.WeixinSDKImpl;
import com.fulihui.weixinsdk.http.HttpSelector;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

/**
 * @author: JY
 * @date: 2018/6/15 10:04
 */
@Configuration
public class BeanConfig {

    @Bean
    @ConfigurationProperties("user.threadPool")
    public ThreadPoolTaskExecutor getThreadPoolTaskExecutor() {
        ThreadPoolTaskExecutor poolTaskExecutor = new ThreadPoolTaskExecutor();
        return poolTaskExecutor;
    }

    @Bean
    public HttpSelector getHttpSelector() {
        return new HttpSelector();
    }

    @Bean
    public WeixinSDK getWeixinSDK() {
        return new WeixinSDKImpl(getHttpSelector());
    }
}
